home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / interp / perl5.005.tar.gz / perl5.005.tar / perl5.005 / pod / perlfaq1.pod < prev    next >
Text File  |  1998-07-05  |  13KB  |  263 lines

  1. =head1 NAME
  2.  
  3. perlfaq1 - General Questions About Perl ($Revision: 1.14 $, $Date: 1998/06/14 22:15:25 $)
  4.  
  5. =head1 DESCRIPTION
  6.  
  7. This section of the FAQ answers very general, high-level questions
  8. about Perl.
  9.  
  10. =head2 What is Perl?
  11.  
  12. Perl is a high-level programming language with an eclectic heritage
  13. written by Larry Wall and a cast of thousands.  It derives from the
  14. ubiquitous C programming language and to a lesser extent from sed,
  15. awk, the Unix shell, and at least a dozen other tools and languages.
  16. Perl's process, file, and text manipulation facilities make it
  17. particularly well-suited for tasks involving quick prototyping, system
  18. utilities, software tools, system management tasks, database access,
  19. graphical programming, networking, and world wide web programming.
  20. These strengths make it especially popular with system administrators
  21. and CGI script authors, but mathematicians, geneticists, journalists,
  22. and even managers also use Perl.  Maybe you should, too.
  23.  
  24. =head2 Who supports Perl?  Who develops it?  Why is it free?
  25.  
  26. The original culture of the pre-populist Internet and the deeply-held
  27. beliefs of Perl's author, Larry Wall, gave rise to the free and open
  28. distribution policy of perl.  Perl is supported by its users.  The
  29. core, the standard Perl library, the optional modules, and the
  30. documentation you're reading now were all written by volunteers.  See
  31. the personal note at the end of the README file in the perl source
  32. distribution for more details.
  33.  
  34. In particular, the core development team (known as the Perl
  35. Porters) are a rag-tag band of highly altruistic individuals
  36. committed to producing better software for free than you
  37. could hope to purchase for money.  You may snoop on pending
  38. developments via news://genetics.upenn.edu/perl.porters-gw/ and
  39. http://www.frii.com/~gnat/perl/porters/summary.html.
  40.  
  41. While the GNU project includes Perl in its distributions, there's no
  42. such thing as "GNU Perl".  Perl is not produced nor maintained by the
  43. Free Software Foundation.  Perl's licensing terms are also more open
  44. than GNU software's tend to be.
  45.  
  46. You can get commercial support of Perl if you wish, although for most
  47. users the informal support will more than suffice.  See the answer to
  48. "Where can I buy a commercial version of perl?" for more information.
  49.  
  50. =head2 Which version of Perl should I use?
  51.  
  52. You should definitely use version 5.  Version 4 is old, limited, and
  53. no longer maintained; its last patch (4.036) was in 1992.  The most
  54. recent production release is 5.004_01.  Further references to the Perl
  55. language in this document refer to this production release unless
  56. otherwise specified.  There may be one or more official bug fixes for
  57. 5.004_01 by the time you read this, and also perhaps some experimental
  58. versions on the way to the next release.
  59.  
  60. =head2 What are perl4 and perl5?
  61.  
  62. Perl4 and perl5 are informal names for different versions of the Perl
  63. programming language.  It's easier to say "perl5" than it is to say
  64. "the 5(.004) release of Perl", but some people have interpreted this
  65. to mean there's a language called "perl5", which isn't the case.
  66. Perl5 is merely the popular name for the fifth major release (October 1994),
  67. while perl4 was the fourth major release (March 1991).  There was also a
  68. perl1 (in January 1988), a perl2 (June 1988), and a perl3 (October 1989).
  69.  
  70. The 5.0 release is, essentially, a complete rewrite of the perl source
  71. code from the ground up.  It has been modularized, object-oriented,
  72. tweaked, trimmed, and optimized until it almost doesn't look like the
  73. old code.  However, the interface is mostly the same, and compatibility
  74. with previous releases is very high.
  75.  
  76. To avoid the "what language is perl5?" confusion, some people prefer to
  77. simply use "perl" to refer to the latest version of perl and avoid using
  78. "perl5" altogether.  It's not really that big a deal, though.
  79.  
  80. See L<perlhist> for a history of Perl revisions.
  81.  
  82. =head2 How stable is Perl?
  83.  
  84. Production releases, which incorporate bug fixes and new functionality,
  85. are widely tested before release.  Since the 5.000 release, we have
  86. averaged only about one production release per year.
  87.  
  88. Larry and the Perl development team occasionally make changes to the
  89. internal core of the language, but all possible efforts are made toward
  90. backward compatibility.  While not quite all perl4 scripts run flawlessly
  91. under perl5, an update to perl should nearly never invalidate a program
  92. written for an earlier version of perl (barring accidental bug fixes
  93. and the rare new keyword).
  94.  
  95. =head2 Is Perl difficult to learn?
  96.  
  97. No, Perl is easy to start learning -- and easy to keep learning.  It looks
  98. like most programming languages you're likely to have experience
  99. with, so if you've ever written an C program, an awk script, a shell
  100. script, or even BASIC program, you're already part way there.
  101.  
  102. Most tasks only require a small subset of the Perl language.  One of
  103. the guiding mottos for Perl development is "there's more than one way
  104. to do it" (TMTOWTDI, sometimes pronounced "tim toady").  Perl's
  105. learning curve is therefore shallow (easy to learn) and long (there's
  106. a whole lot you can do if you really want).
  107.  
  108. Finally, Perl is (frequently) an interpreted language.  This means
  109. that you can write your programs and test them without an intermediate
  110. compilation step, allowing you to experiment and test/debug quickly
  111. and easily.  This ease of experimentation flattens the learning curve
  112. even more.
  113.  
  114. Things that make Perl easier to learn: Unix experience, almost any kind
  115. of programming experience, an understanding of regular expressions, and
  116. the ability to understand other people's code.  If there's something you
  117. need to do, then it's probably already been done, and a working example is
  118. usually available for free.  Don't forget the new perl modules, either.
  119. They're discussed in Part 3 of this FAQ, along with the CPAN, which is
  120. discussed in Part 2.
  121.  
  122. =head2 How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?
  123.  
  124. Favorably in some areas, unfavorably in others.  Precisely which areas
  125. are good and bad is often a personal choice, so asking this question
  126. on Usenet runs a strong risk of starting an unproductive Holy War.
  127.  
  128. Probably the best thing to do is try to write equivalent code to do a
  129. set of tasks.  These languages have their own newsgroups in which you
  130. can learn about (but hopefully not argue about) them.
  131.  
  132. =head2 Can I do [task] in Perl?
  133.  
  134. Perl is flexible and extensible enough for you to use on almost any
  135. task, from one-line file-processing tasks to complex systems.  For
  136. many people, Perl serves as a great replacement for shell scripting.
  137. For others, it serves as a convenient, high-level replacement for most
  138. of what they'd program in low-level languages like C or C++.  It's
  139. ultimately up to you (and possibly your management ...) which tasks
  140. you'll use Perl for and which you won't.
  141.  
  142. If you have a library that provides an API, you can make any component
  143. of it available as just another Perl function or variable using a Perl
  144. extension written in C or C++ and dynamically linked into your main
  145. perl interpreter.  You can also go the other direction, and write your
  146. main program in C or C++, and then link in some Perl code on the fly,
  147. to create a powerful application.
  148.  
  149. That said, there will always be small, focused, special-purpose
  150. languages dedicated to a specific problem domain that are simply more
  151. convenient for certain kinds of problems.  Perl tries to be all things
  152. to all people, but nothing special to anyone.  Examples of specialized
  153. languages that come to mind include prolog and matlab.
  154.  
  155. =head2 When shouldn't I program in Perl?
  156.  
  157. When your manager forbids it -- but do consider replacing them :-).
  158.  
  159. Actually, one good reason is when you already have an existing
  160. application written in another language that's all done (and done
  161. well), or you have an application language specifically designed for a
  162. certain task (e.g. prolog, make).
  163.  
  164. For various reasons, Perl is probably not well-suited for real-time
  165. embedded systems, low-level operating systems development work like
  166. device drivers or context-switching code, complex multithreaded
  167. shared-memory applications, or extremely large applications.  You'll
  168. notice that perl is not itself written in Perl.
  169.  
  170. The new native-code compiler for Perl may reduce the limitations given
  171. in the previous statement to some degree, but understand that Perl
  172. remains fundamentally a dynamically typed language, and not a
  173. statically typed one.  You certainly won't be chastized if you don't
  174. trust nuclear-plant or brain-surgery monitoring code to it.  And
  175. Larry will sleep easier, too -- Wall Street programs not
  176. withstanding. :-)
  177.  
  178. =head2 What's the difference between "perl" and "Perl"?
  179.  
  180. One bit.  Oh, you weren't talking ASCII? :-) Larry now uses "Perl" to
  181. signify the language proper and "perl" the implementation of it,
  182. i.e. the current interpreter.  Hence Tom's quip that "Nothing but perl
  183. can parse Perl."  You may or may not choose to follow this usage.  For
  184. example, parallelism means "awk and perl" and "Python and Perl" look
  185. ok, while "awk and Perl" and "Python and perl" do not.
  186.  
  187. =head2 Is it a Perl program or a Perl script?
  188.  
  189. It doesn't matter.
  190.  
  191. In "standard terminology" a I<program> has been compiled to physical
  192. machine code once, and can then be be run multiple times, whereas a
  193. I<script> must be translated by a program each time it's used.  Perl
  194. programs, however, are usually neither strictly compiled nor strictly
  195. interpreted.  They can be compiled to a byte code form (something of a
  196. Perl virtual machine) or to completely different languages, like C or
  197. assembly language.  You can't tell just by looking whether the source
  198. is destined for a pure interpreter, a parse-tree interpreter, a byte
  199. code interpreter, or a native-code compiler, so it's hard to give a
  200. definitive answer here.
  201.  
  202. =head2 What is a JAPH?
  203.  
  204. These are the "just another perl hacker" signatures that some people
  205. sign their postings with.  About 100 of the of the earlier ones are
  206. available from http://www.perl.com/CPAN/misc/japh .
  207.  
  208. =head2 Where can I get a list of Larry Wall witticisms?
  209.  
  210. Over a hundred quips by Larry, from postings of his or source code,
  211. can be found at http://www.perl.com/CPAN/misc/lwall-quotes .
  212.  
  213. =head2 How can I convince my sysadmin/supervisor/employees to use version (5/5.004/Perl instead of some other language)?
  214.  
  215. If your manager or employees are wary of unsupported software, or
  216. software which doesn't officially ship with your Operating System, you
  217. might try to appeal to their self-interest.  If programmers can be
  218. more productive using and utilizing Perl constructs, functionality,
  219. simplicity, and power, then the typical manager/supervisor/employee
  220. may be persuaded.  Regarding using Perl in general, it's also
  221. sometimes helpful to point out that delivery times may be reduced
  222. using Perl, as compared to other languages.
  223.  
  224. If you have a project which has a bottleneck, especially in terms of
  225. translation or testing, Perl almost certainly will provide a viable,
  226. and quick solution.  In conjunction with any persuasion effort, you
  227. should not fail to point out that Perl is used, quite extensively, and
  228. with extremely reliable and valuable results, at many large computer
  229. software and/or hardware companies throughout the world.  In fact,
  230. many Unix vendors now ship Perl by default, and support is usually
  231. just a news-posting away, if you can't find the answer in the
  232. I<comprehensive> documentation, including this FAQ.
  233.  
  234. If you face reluctance to upgrading from an older version of perl,
  235. then point out that version 4 is utterly unmaintained and unsupported
  236. by the Perl Development Team.  Another big sell for Perl5 is the large
  237. number of modules and extensions which greatly reduce development time
  238. for any given task.  Also mention that the difference between version
  239. 4 and version 5 of Perl is like the difference between awk and C++.
  240. (Well, ok, maybe not quite that distinct, but you get the idea.)  If
  241. you want support and a reasonable guarantee that what you're
  242. developing will continue to work in the future, then you have to run
  243. the supported version.  That probably means running the 5.004 release,
  244. although 5.003 isn't that bad (it's just one year and one release
  245. behind).  Several important bugs were fixed from the 5.000 through
  246. 5.002 versions, though, so try upgrading past them if possible.
  247.  
  248. =head1 AUTHOR AND COPYRIGHT
  249.  
  250. Copyright (c) 1997, 1998 Tom Christiansen and Nathan Torkington.
  251. All rights reserved.
  252.  
  253. When included as an integrated part of the Standard Distribution
  254. of Perl or of its documentation (printed or otherwise), this works is
  255. covered under Perl's Artistic Licence.  For separate distributions of
  256. all or part of this FAQ outside of that, see L<perlfaq>.
  257.  
  258. Irrespective of its distribution, all code examples here are public
  259. domain.  You are permitted and encouraged to use this code and any
  260. derivatives thereof in your own programs for fun or for profit as you
  261. see fit.  A simple comment in the code giving credit to the FAQ would
  262. be courteous but is not required.
  263.